/**
 * 文件上传
 */
import { requestData } from '@/utils/request'

const prefix = '/file'

const baseApi = {
  delete(fileName) {
    return requestData({
      url: `${prefix}/delete`,
      method: 'delete',
      params: { fileName }
    })
  },
  uploadImageUrl: `${process.env.VUE_APP_BASE_API + prefix}/uploadImage`,
  uploadImage(data) {
    return requestData({
      url: `${prefix}/uploadImage`,
      method: 'post',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      data
    })
  },
  uploadVideoUrl: `${process.env.VUE_APP_BASE_API + prefix}/uploadVideo`,
  uploadVideo(data) {
    return requestData({
      url: `${prefix}/uploadVideo`,
      method: 'post',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      data
    })
  },
  uploadHtmlUrl: `${process.env.VUE_APP_BASE_API + prefix}/uploadHtml`,
  uploadHtml(data) {
    return requestData({
      url: `${prefix}/uploadHtml`,
      method: 'post',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      data
    })
  }
}

export default baseApi
